﻿/*
	1.没有进行校验处理
 */




#include <termios.h>
#include <dlfcn.h>



#include "readCard.h"
#include "head.h"
#include "uartApi.h"
#include "read_date.h"
int readCard_fd;

int open_readCarder(int select)
{
	
	printf("open readCarder dev!\n");
	
	if((readCard_fd = open_port(select) )< 0)
	{
		perror("open readCarder dev error...");
		return -1;
	}
	//3,2波特率：9600,数据位：8位，偶数校验，1位停止位
	if(set_opt(readCard_fd,9600,8,'N',1)<0)
	{
		perror("set_opt readCarder error...");
		return -1;
	}
	return 0;
}


int main()
{

	int uart_select;
	scanf("%d",&uart_select);
	open_readCarder(uart_select);

	char buf[50]= {0x01,0x02};
	while(1)
	{	
//	write(readCard_fd,buf,strlen(buf));
	printf("%x\n",read_date(readCard_fd));

//	sleep(1);

	}

}

